/*
 * Created by Christopher King
 * Copyright (C) 2007 Christopher King, All Rights Reserved.
 */

package us.cirion.adventure.engine.prerequisite;

import us.cirion.adventure.engine.Noun;
import us.cirion.adventure.engine.PreRequisite;
import us.cirion.adventure.engine.Room;

/**
 * Requires that the item exist within the particular room.
 * 
 * @author Chris
 */
public class ItemInRoom implements PreRequisite
{

	private Noun item;
	private Room location;

	/**
	 * Constructs a new requirement that this item exist within this room.
	 * 
	 * @param item The item whose location will be examined.
	 * @param location The required location of the item.
	 */
	public ItemInRoom(Noun item, Room location)
	{
		this.item = item;
		this.location = location;
	}

	/**
	 * Indicates whether the item is located within this room.
	 * 
	 * @return <code>true</code> if the item is in this room,
	 *         <code>false</code> otherwise.
	 */
	public boolean isSatisfied()
	{
		return item.getLocation().equals(location);
	}

}
